<?php

require_once('simpletest/unit_tester.php');
require_once('simpletest/reporter.php');

require_once('../post_controller.php');

class PostControllerTest extends UnitTestCase{
	
	const CATEGORY_ID = "4";
	
	function test_getPostByCategory(){
		
		$pc = new PostController();
		$pass = false;
		
		foreach($pc->getPostsByCategory(PostControllerTest::CATEGORY_ID) as $p){
			foreach(array_values($p) as $value){
				if($value == "test post")
					$pass = true;
			}
		}
		$this->assertTrue($pass);
	}
	
}
$test = &new PostControllerTest();
$test->run(new HtmlReporter());
?>
